from flask import Flask
import config
from exts import db, mail
from models import UserModel
from flask_migrate import Migrate


# 导入蓝图文件中所创建的实例
from blueprints.auth import bp as auth_bp
from blueprints.qa import bp as qa_bp

# 创建flask实例
app = Flask(__name__)

# 实例app与config文件进行绑定
app.config.from_object(config)

# 初始化数据库
db.init_app(app)

# 初始化邮件
mail.init_app(app)

# 初始化迁移器
migrate = Migrate(app, db)

# 注册蓝图
app.register_blueprint(auth_bp)
app.register_blueprint(qa_bp)

if __name__ == '__main__':
    app.run()
